<template>
  <div>
    {{getCount}}
    <button @click="plusCount">加一</button>
  </div>
</template>

<script>
    export default {
        name: "HelloVuex",
      computed:{
          getCount(){
            return this.$store.getters.getCount;
          }
      },
      methods:{
          plusCount(){
            // var count = this.$store.state.count;
            // this.$store.commit('increment', 2)
            this.$store.dispatch('increment', 2);
          }
      }
    }
</script>

<style scoped>

</style>
